﻿#include "userservice.h"

#include <databasecenter.h>

UserService::UserService(QObject *parent)
    : QObject(parent)
{
    db = DatabaseCenter::getInstance().getConnection();
}

UserService::~UserService()
{
    DatabaseCenter::getInstance().releaseConnection(db);
}

bool UserService::getList(QList<User> &list, const QVariantMap &param)
{
    UserDao userDao(db);
    return userDao.getList(list, param);
}

bool UserService::getTotal(uint64_t &total, const QVariantMap &param)
{
    UserDao userDao(db);
    return userDao.getTotal(total, param);
}

bool UserService::getOne(User &object)
{
    UserDao userDao(db);
    return userDao.getOne(object);
}

bool UserService::saveOne(User &object, QBaseEntity::PropertiesType propertiesType, QStringList properties)
{
    UserDao userDao(db);
    return userDao.saveOne(object, propertiesType, properties);
}

bool UserService::deleteOne(User &object)
{
    UserDao userDao(db);
    return userDao.deleteOne(object);
}
